import axios from '@/api/fetch';
//import * as types from './types';
import SERVER from '@/api/server';

//预授权经销商维护-主机厂
//预授权经销商维护-主页面查询
export const getListByPage = params => axios.post(`${SERVER.CLAIMFAC}/rPPreAuthArea/getListByPage`, params);
//新增的保存
export const newSave = params => axios.post(`${SERVER.CLAIMFAC}/rPPreAuthArea/saveOne`,  params );
//Excel导出
export const excelExport = params => axios.get(`${SERVER.CLAIMFAC}/rPPreAuthArea/getListForExport`,params);
//主页面的单条删除
// export const deleteOne = params => axios.post(`${SERVER.CLAIMFAC}/rPPreAuthArea/updateStatusByDealerCode`,params);
export const deleteOne = (id, params) => axios.post(`${SERVER.CLAIMFAC}/rPPreAuthArea/updateStatusByDealerCode/${id}`,{params} );
//配件类型查询
export const selectListByPage = params => axios.get(`${SERVER.CLAIMFAC}/rPPreAuthArea/getListByPage`,params);
//回显
export const huixian = (id, params) => axios.get(`${SERVER.CLAIMFAC}/rPPreAuthArea/selectByDealerCode/${id}`,{params} );

//编辑保存
export const editSave = params => axios.post(`${SERVER.CLAIMFAC}/rPPreAuthArea/updateByPtId`,  params );



//导出模版
export const downloadModel = params => {
  const url = `${SERVER.CLAIMFAC}/rPPreAuthArea/exportModel`;
  return axios({
    url,
    method: 'post',
    responseType: 'blob'
  });
};
//导出
export const getListForExport = (params) => axios.post(`${SERVER.CLAIMFAC}/rPPreAuthArea/getListForExport`, params, {
  responseType: 'blob'
});

//字典
export const getPartType = params => axios.get(`${SERVER.CLAIMFAC}/const/getBaseDataByType`, {params});
//下载中心导出
export const exporturl = params => axios.post(`/api/cmscloud.excel/downloadExcel/exportExcel/${params.CODE}`, params);